/* File : SODxml.h */

#include <vector>
#include "Helpers4XML.h"

using namespace std;

class SODxml {
public:
  SODxml() {
  }
  virtual ~SODxml() {
  };  
};

//class Data : public SODxml {
//	const char* length;
//	const char* width;
//	const char* number_of_storeys;
//public:
//	const char* get_length() { return length; }
//	void set_length(const char* l) { length = l; }
//	const char* get_width() { return width; }
//	void set_width(const char* w) { width = w; }
//	const char* get_NOS() { return number_of_storeys; }
//	void set_NOS(const char* n) { number_of_storeys = n; }
//
//	virtual void set_default(void);
//};

//typedef struct _Point {
//	double x;
//	double y;
//	double z;
//} Point;
class Point
{
public:
  Point ();
  Point (double x_, double y_, double z_);
  double x;
  double y;
  double z;
};

//class Bar 
//{
//public:  
//  vector<Point> points;
//};

class Bar : public SODxml {
	double length;
	double width;
	Point origin;
	Point direction;
	int number_of_storeys;
  //vector<Point> points;
  //vector<Bar> bars;
public:
  Bar();
	double get_length() { return length; }
	void set_length(double l) { length = l; }
	double get_width() { return width; }
	void set_width(double w) { width = w; }
	int get_NOS() { return number_of_storeys; }
	void set_NOS(int n) { number_of_storeys = n; }
	Point get_origin() { return origin; }
  void set_origin(Point p) { origin = p; }
  Point get_direction() { return direction; }
  void set_direction(Point d) { direction = d; }

  //vector<Point>& Points() { return points; }
  //void Points(const vector<Point>& val) { points = val; }



  //void set_bars(vector<Bar>& bs) { bars = bs; }
  //void dump_bars();

	virtual void set_default(void);

	friend class File; //to access private values
};


class Building : public SODxml {
  vector<Bar> bars;
  vector<double> sg_values;
  double tot_vc;
  double tot_mr;
  double tot_mp;
  double tot_mq;
  double tot_aa;
public:
  Building();

  void Bars(const vector<Bar> & vecBars){bars = vecBars;}
  vector<Bar>& Bars(void) {return bars;}
  Bar& BarAt(unsigned int i){return bars[i];}
	vector<double>& SgValues() { return sg_values; }
	void SgValues(vector<double>& sg) { sg_values = sg; }
	double TOT_vc() { return tot_vc; }
	double TOT_mr() { return tot_mr; }
	double TOT_mp() { return tot_mp; }
	double TOT_mq() { return tot_mq; }
	double TOT_aa() { return tot_aa; }

	void SgValues(double vc, double mr, double mp, double mq, double aa) { 
		tot_vc = vc; tot_mr = mr; tot_mp = mp; tot_mq = mq; tot_aa = aa; 
	}

	friend class File; //to access private values
};


class File : public SODxml {
private:
	int variant;
	//vector<Bar> bars;
public:
	//const char* path;
  void read(const char* path, Bar &bar);
  int write(const char* path, Bar &bar);
  void read(const char* path, Building &data);
  int write(const char* path, Building &data);

  //void set_bars(vector<Bar>& bs) { bars = bs; }
  //void dump_bars();
};



  
